package com.whu.helpluojia.controller;

import com.whu.helpluojia.domain.Supply;
import com.whu.helpluojia.service.SupplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/supply")
public class SupplyController {

    @Autowired
    SupplyService supplyService;

    @PostMapping("/insert")
    public void insert(@RequestBody Supply supply){
        supplyService.addSupply(supply);
    }

    @GetMapping("/{id}")
    public Supply getSupplyById(@PathVariable Long id){
        return supplyService.getById(id);
    }
}
